package com.lite.haru.myadapter;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.kymjs.kjframe.widget.AdapterHolder;
import org.kymjs.kjframe.widget.KJAdapter;

import android.widget.AbsListView;

import com.lite.haru.R;
import com.lite.haru.entity.AlarmInfo;

/**
 * 待处理信息的适配器
 * 
 * @author haru
 *
 */
public class MyAlarmInfoPendingAdp extends KJAdapter<AlarmInfo> {

	private List<AlarmInfo> pending_datas = new ArrayList<AlarmInfo>();// 待处理的数据

	public MyAlarmInfoPendingAdp(AbsListView view,
			Collection<AlarmInfo> mDatas, int itemLayoutId) {
		super(view, mDatas, itemLayoutId);
	}

	public void onDateChange(List<AlarmInfo> pending_datas) {
		this.pending_datas =pending_datas;
		this.notifyDataSetChanged();
	}

	public List<AlarmInfo> getPending_datas() {
		return pending_datas;
	}

	public void setPending_datas(List<AlarmInfo> pending_datas) {
		this.pending_datas = pending_datas;
	}

	/**
	 * a_phone报警人手机号
	 */

	@Override
	public void convert(AdapterHolder arg0, AlarmInfo arg1, boolean arg2) {

		String type = null;
		if (arg1.getAlarmtype().equals("message")) {
			type = "短信";
		} else if (arg1.getAlarmtype().equals("photo")) {
			type = "照片";
		} else if (arg1.getAlarmtype().equals("record")) {
			type = "录音";
		} else if (arg1.getAlarmtype().equals("video")) {
			type = "视频";
		}

		arg0.setText(R.id.alarm_info, "报警信息：" + arg1.getDisaster());
		arg0.setText(R.id.alarm_level, "报警等级：" + arg1.getGrade());
		arg0.setText(R.id.alarm_statement, "报警人：" + arg1.getUsername() + " 方式:"
				+ type);
		arg0.setText(R.id.alarm_time, " " + arg1.getAlarm_time());
	}

}
